import React, { MutableRefObject } from 'react'

import './style.less'

export default function NotFound(props: any) {
  const [top, setTop] = React.useState(0)
  const wrap: MutableRefObject<any> = React.useRef(null)
  React.useEffect(() => {
    if (wrap.current) {
      setTop((wrap.current?.offsetHeight - 350) / 2 - 30)
    }
  }, [])
  console.log(props)
  return (
    <div ref={wrap} className="not-found">
      <div className="img-wrap" style={{ marginTop: top + 'px' }}></div>
      <div className="btn-wrap">
        <button className="btn" onClick={() => window.location.reload()}>
          刷新
        </button>
        <button className="btn back" onClick={() => props.history.replace('/')}>
          首页
        </button>
        <button className="btn back" onClick={() => props.history.goBack()}>
          返回
        </button>
      </div>
    </div>
  )
}
